<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>45.es9扩展运算符</title>
</head>
<body>

<script>
  //es6的rest参数针对的是数组，es9的rest参数也可以对对象使用了
  //参数必须也是对象
  function f1({host, port, ...user}) {
    console.log(host)
    console.log(port)
    console.log(user)
  }

  //传入一个对象
  f1({
    host: '127.0.0.1'
    ,port:9000
    ,username: 'zzl'
    ,password: '123456'
  })

  let zuhe = {
    skillOne:'白虎金刚变'
    ,skillTwo:'幽冥突刺'
  }

  //属性名称相同时，后者会覆盖前者
  let zuhe2 = {
    skillOne:'白虎金刚'
    ,skillThree:'白虎护身'
  }

  let zuhe3 = {
    ...zuhe,
    ...zuhe2
  }

  console.log(zuhe3)


</script>
</body>
</html>